package test;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ReadServlet extends HttpServlet {

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO 自動生成されたメソッド・スタブ
		doAttrivute(req, resp);
	}

	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO 自動生成されたメソッド・スタブ
		doAttrivute(req, resp);
	}

	protected void doAttrivute(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {

		BlogController bc = new BlogController();
		List<Topic> listTopic = bc.getBlogList();

		req.setAttribute("listTopic", listTopic);

		req.getRequestDispatcher("/WEB-INF/read.jsp").forward(req, resp);
	}
}
